package com.mgface.platform.machinelearing;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.awt.image.WritableRaster;
import java.io.File;
import java.io.IOException;

/**
 * Hello world!
 */
public class App {
    public static void main(String[] args) throws IOException {
//        for (String readerFileSuffix : ImageIO.getReaderFileSuffixes()) {
//            System.out.println(readerFileSuffix);
//        }
//        System.out.println("=============");
//        for (String writerFileSuffix : ImageIO.getWriterFileSuffixes()) {
//            System.out.println(writerFileSuffix);
//        }
        File file = new File("C:\\Users\\wanyuxiang\\Downloads\\北理春光特别限量款\\mobile版本\\竖版-10.jpg");
        BufferedImage read = ImageIO.read(file);
        System.out.println(read.getWidth());
        System.out.println(read.getHeight());
        WritableRaster raster = read.getRaster();
        int[] pixel = new int[3];
        raster.getPixel(1500, 2600, pixel);
        System.out.println(String.format("%s,%s,%s", pixel[0], pixel[1], pixel[2]));
        pixel[0] = 0;
        pixel[1] = 255;
        pixel[2] = 255;
        for (int i = 0; i < 1000; i++) {
            for (int j = 0; j < 100; j++) {
                raster.setPixel(i,j,pixel);
            }
        }
//        File outFile = new File("C:\\Users\\wanyuxiang\\Downloads\\北理春光特别限量款\\mobile版本\\set_pixels.jpg");
//        ImageIO.write(read,"jpg",outFile);
        System.out.println(Math.pow(5,2));
        System.out.println(Math.floor(20/3));
    }
}
